},
_addApp: function(app) {
- let App = new AppWellIcon(this._appSystem.get_app(app.get_id()));
- App.connect('launching', Lang.bind(this, function() {
+ let appIcon = new AppWellIcon(this._appSystem.get_app(app.get_id()));
+ appIcon.connect('launching', Lang.bind(this, function() {
this.emit('launching');
}));
- App._draggable.connect('drag-begin', Lang.bind(this, function() {
+ appIcon._draggable.connect('drag-begin', Lang.bind(this, function() {
this.emit('drag-begin');
}));
- this._grid.addItem(App.actor);
+ this._grid.addItem(appIcon.actor);
- this._apps.push(App);
+ this._apps.push(appIcon);
},
refresh: function(apps) {
this._draggable.connect('drag-begin', Lang.bind(this,
function () {
this._removeMenuTimeout();
+ Main.overview.beginItemDrag(this);
+ }));
+ this._draggable.connect('drag-end', Lang.bind(this,
+ function () {
+ Main.overview.endItemDrag(this);
}));
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('clicked', Lang.bind(this, this._onResultClicked));
let draggable = DND.makeDraggable(this.actor);
+ draggable.connect('drag-begin',
+ Lang.bind(this, function() {
+ Main.overview.beginItemDrag(this);
+ }));
+ draggable.connect('drag-end',
+ Lang.bind(this, function() {
+ Main.overview.endItemDrag(this);
+ }));
},
setSelected: function(selected) {
this.actor._delegate = this;
let draggable = DND.makeDraggable(this.actor);
+ draggable.connect('drag-begin',
+ Lang.bind(this, function() {
+ Main.overview.beginItemDrag(this);
+ }));
+ draggable.connect('drag-end',
+ Lang.bind(this, function() {
+ Main.overview.endItemDrag(this);
+ }));
},
getUri: function() {
}));
let draggable = DND.makeDraggable(this.actor);
+ draggable.connect('drag-begin',
+ Lang.bind(this, function() {
+ Main.overview.beginItemDrag(this);
+ }));
+ draggable.connect('drag-end',
+ Lang.bind(this, function() {
+ Main.overview.endItemDrag(this);
+ }));
this._iconBin = new St.Bin();
this.actor.add(this._iconBin);
}));
},
- //// Draggable target interface ////
-
- // Closes any active panes if a GenericDisplayItem is being
- // dragged over the Overview, i.e. as soon as it starts being dragged.
- // This allows the user to place the item on any workspace.
- handleDragOver : function(source, actor, x, y, time) {
- if (source instanceof GenericDisplay.GenericDisplayItem
- || source instanceof AppDisplay.AppIcon) {
+ //// Public methods ////
+
+ beginItemDrag: function(source) {
+ // Close any active panes if @source is a GenericDisplayItem.
+ // This allows the user to place the item on any workspace.
+ if (source instanceof GenericDisplay.GenericDisplayItem)
if (this._activeDisplayPane != null)
this._activeDisplayPane.close();
- return true;
- }
-
- return false;
+ this.emit('item-drag-begin');
},
- //// Public methods ////
+ endItemDrag: function(source) {
+ this.emit('item-drag-end');
+ },
// Returns the scale the Overview has when we just start zooming out
// to overview mode. That is, when just the active workspace is showing.
this.actor._delegate = this;
this._draggable = DND.makeDraggable(this.actor);
+ this._draggable.connect('drag-begin',
+ Lang.bind(this, function() {
+ Main.overview.beginItemDrag(this);
+ }));
+ this._draggable.connect('drag-end',
+ Lang.bind(this, function() {
+ Main.overview.endItemDrag(this);
+ }));
},
_onClicked: function(b) {
GenericWorkspacesView.prototype._init.call(this, width, height, x, y, workspaces);
+ this._itemDragBeginId = Main.overview.connect('item-drag-begin',
+ Lang.bind(this, this._dragBegin));
+ this._itemDragEndId = Main.overview.connect('item-drag-end',
+ Lang.bind(this, this._dragEnd));
for (let i = 0; i < this._workspaces.length; i++) {
this._workspaces[i]._windowDragBeginId = this._workspaces[i].connect('window-drag-begin',
- Lang.bind(this, this._onWindowDragBegin));
+ Lang.bind(this, this._dragBegin));
this._workspaces[i]._windowDragEndId = this._workspaces[i].connect('window-drag-end',
- Lang.bind(this, this._onWindowDragEnd));
+ Lang.bind(this, this._dragEnd));
}
this.actor.add_actor(this._newWorkspaceArea.actor);
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
this.actor.add_actor(this._workspaces[w].actor);
this._workspaces[w]._windowDragBeginId = this._workspaces[w].connect('window-drag-begin',
- Lang.bind(this, this._onWindowDragBegin));
+ Lang.bind(this, this._dragBegin));
this._workspaces[w]._windowDragEndId = this._workspaces[w].connect('window-drag-end',
- Lang.bind(this, this._onWindowDragEnd));
+ Lang.bind(this, this._dragEnd));
}
this._computeWorkspacePositions();
Mainloop.source_remove(this._timeoutId);
this._timeoutId = 0;
}
+ if (this._itemDragBeginId > 0) {
+ Main.overview.disconnect(this._itemDragBeginId);
+ this._itemDragBeginId = 0;
+ }
+ if (this._itemDragEndId > 0) {
+ Main.overview.disconnect(this._itemDragEndId);
+ this._itemDragEndId = 0;
+ }
for (let w = 0; w < this._workspaces.length; w++) {
if (this._workspaces[w]._windowDragBeginId) {
this._workspaces[w].disconnect(this._workspaces[w]._windowDragBeginId);
return false;
},
- _onWindowDragBegin: function(w, actor) {
+ _dragBegin: function() {
if (!this._scroll || this._scrolling)
return;
}
},
- _onWindowDragEnd: function(w, actor) {
+ _dragEnd: function() {
if (this._timeoutId) {
Mainloop.source_remove(this._timeoutId);
this._timeoutId = 0;